package cn.yunbamboos.media.properties;

import cn.hutool.core.util.StrUtil;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.io.File;

@ConfigurationProperties(
        prefix = "yunbamboos.media"
)
public class YunbamboosMediaProperties {
    // 启用流媒体
    private boolean enabled = false;
    // 流媒体文件位置 配置文件 日志 web文件
    private String dir;

    private String hookPath;
    private String mediaServerId = "yunbamboos_media_server";
    //
    private String secret;
    // ffmpeg 所在路径
    private String ffmpegPath;
    // 流媒体IP 默认 127.0.0.1
    private String ip = "127.0.0.1";
    // 流媒体HTTP端口
    private int port = 20080;
    private int sslPort = 0;
    // 流媒体RTSP端口
    private int rtspPort = 20554;
    private int rtspSslPort = 0;
    // 流媒体RTMP端口
    private int rtmpPort = 21935;
    private int rtmpSslPort = 0;
    // rtp端口
    private int rtpPort = 20000;
    // rtc端口
    private int rtcPort = 28000;
    // srt
    private int srtPort = 0;
    // 日志等级 0：TRACE 1：DEBUG 2：INFO 3：WARN 4：ERROR
    private int logLevel = 1;
    // 日志最多保存天数
    private int logMaxDay = 7;
    // 线程数
    private int threadNum = 4;
    // 最大保存日志切片个数
    private int logSlice = 100;
    // 单个日志切片最大容量,单位MB
    private int logSize = 5;

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getDir() {
        if (StrUtil.isBlank(dir)) {
            return StrUtil.format("{}{}ZLMediaKit{}", System.getProperty("user.dir"), File.separator, File.separator);
        }
        return dir;
    }

    public void setDir(String dir) {
        this.dir = dir;
    }

    public String getHookPath() {
        return hookPath;
    }

    public void setHookPath(String hookPath) {
        this.hookPath = hookPath;
    }

    public String getMediaServerId() {
        return mediaServerId;
    }

    public void setMediaServerId(String mediaServerId) {
        this.mediaServerId = mediaServerId;
    }

    public String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public String getFfmpegPath() {
        return ffmpegPath;
    }

    public void setFfmpegPath(String ffmpegPath) {
        this.ffmpegPath = ffmpegPath;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getSslPort() {
        return sslPort;
    }

    public void setSslPort(int sslPort) {
        this.sslPort = sslPort;
    }

    public int getRtspPort() {
        return rtspPort;
    }

    public void setRtspPort(int rtspPort) {
        this.rtspPort = rtspPort;
    }

    public int getRtspSslPort() {
        return rtspSslPort;
    }

    public void setRtspSslPort(int rtspSslPort) {
        this.rtspSslPort = rtspSslPort;
    }

    public int getRtmpPort() {
        return rtmpPort;
    }

    public void setRtmpPort(int rtmpPort) {
        this.rtmpPort = rtmpPort;
    }

    public int getRtmpSslPort() {
        return rtmpSslPort;
    }

    public void setRtmpSslPort(int rtmpSslPort) {
        this.rtmpSslPort = rtmpSslPort;
    }

    public int getRtpPort() {
        return rtpPort;
    }

    public void setRtpPort(int rtpPort) {
        this.rtpPort = rtpPort;
    }

    public int getRtcPort() {
        return rtcPort;
    }

    public void setRtcPort(int rtcPort) {
        this.rtcPort = rtcPort;
    }

    public int getSrtPort() {
        return srtPort;
    }

    public void setSrtPort(int srtPort) {
        this.srtPort = srtPort;
    }

    public int getLogLevel() {
        return logLevel;
    }

    public void setLogLevel(int logLevel) {
        this.logLevel = logLevel;
    }

    public int getLogMaxDay() {
        return logMaxDay;
    }

    public void setLogMaxDay(int logMaxDay) {
        this.logMaxDay = logMaxDay;
    }

    public int getThreadNum() {
        return threadNum;
    }

    public void setThreadNum(int threadNum) {
        this.threadNum = threadNum;
    }

    public int getLogSlice() {
        return logSlice;
    }

    public void setLogSlice(int logSlice) {
        this.logSlice = logSlice;
    }

    public int getLogSize() {
        return logSize;
    }

    public void setLogSize(int logSize) {
        this.logSize = logSize;
    }
}
